import axios from '@/utils/request';
const baseOriginURL = process.env.VUE_APP_BASE_ORIGIN + '/iot_maintenance';
const baseOriginDeviceURL = process.env.VUE_APP_BASE_ORIGIN + '/iot_device';

//获取报警通知列表
const getAlarmNoticeList = data => {
  return axios.get(baseOriginURL + '/maintenance/getAlarmNoticeList', {
    params: data
  });
};
//按报警等级获取通知统计
const getNoticeGradeCount = data => {
  return axios.get(baseOriginURL + '/maintenance/getNoticeGradeCount',{
    params: data
  });
};
//查询工单top10
const getOrderTop = data => {
  return axios.get(baseOriginURL + '/maintenance/getOrderTop',{
    params: data
  });
};
// 查询工单统计
const getYearOrderCount = data => {
  return axios.get(baseOriginURL + '/maintenance/getYearOrderCount',{
    params: data
  });
};
// 按年份月份获取通知统计
const getNoticeCount = data => {
  return axios.get(baseOriginURL + '/maintenance/getNoticeCount',{
    params: data
  });
};
// 工程师统计数
const getOrderListByEngineerForApp = data => {
  return axios.get(baseOriginURL + '/maintenance/getOrderListByEngineerForApp',{
    params: data
  });
};
//工单创建
const createOrder = data => {
  return axios.post(baseOriginURL + '/maintenance/createOrder', data);
};
//上传文件
const uploadFile = data => {
  return axios.post(process.env.VUE_APP_BASE_ORIGIN + '/iot_common' + '/uploadFile', data);
};
//获取设备
const getDeviceList = data => {
  return axios.get(baseOriginDeviceURL + '/device/getDeviceList',{
    params: data
  });
};
//获取设备最新的项目编号
const getDeviceLastProject = data => {
  return axios.get(baseOriginURL + '/maintenance/getDeviceLastProject', {
      params: data
  });
};
//获取设备最新工单联系人
const getDeviceLastContact = data => {
  return axios.get(baseOriginURL + '/maintenance/getDeviceLastContact', {
      params: data
  });
};
//获取工单管理列表
const getOrderList = data => {
  return axios.get(baseOriginURL + '/maintenance/getOrderList',{
    params: data
  });
};


export {
  getAlarmNoticeList,
  getNoticeGradeCount,
  getOrderTop,
  getYearOrderCount,
  getNoticeCount,
  getOrderListByEngineerForApp,
  createOrder,
  uploadFile,
  getDeviceList,
  getDeviceLastProject,
  getDeviceLastContact,
  getOrderList
};
